﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.IO;

using NLog;

using System.Configuration;
using System.Web.Configuration;

namespace planerka.Common
{
    public static class ExceptionUtility
    {
        // Log an Exception
        public static void LogException(
            Logger logger,
            Exception ex, 
            string source, 
            string message, 
            LogLevel logLevel = null)
        {
            if (logLevel == null)
                logLevel = LogLevel.Error;
            
            LogEventInfo logEvent = new LogEventInfo();
            logEvent.Exception = ex;
            logEvent.Level = logLevel;
            logEvent.Message = "Source: " + source + "\r\nMessage:" + message;
            logEvent.TimeStamp = DateTime.Now;
            logger.Log(logEvent);
        }

   
       
    }
}